/*
*私募产品表格
*privateTable.js*/

import React, {Component,PropTypes} from 'react';
import {connect} from 'dva';
import {routerRedux,Link,withRouter } from 'dva/router';
import { Button,Modal,Row,Col,Table,Pagination,Popconfirm} from 'antd';
import Tablelist from '../../../../components/common/TableData';
import EditPrivatePdt from '../../components/EditPrivatePdt';
import TablePagination from '../../components/TablePagination';
import style from './privateTable.less';

const PrivateTable = ({dispatch,privatePdt}) => {
	const {pdtData,page} = privatePdt;
	const columns = [
		{
			title: '产品名称',
			dataIndex: 'productName',
			key: 'productName',
		},
		{
			title: '备案码',
			dataIndex: 'recordCode',
			key: 'recordCode',
		},
		{
			title: '基金ID',
			dataIndex: 'windCode',
			key: 'windCode',
		},
		{
			title: '所属管理人',
			dataIndex: 'companyId',
			key: 'companyId',
		},
		{
			title: '操作',
			key: 'action',
			render:(record)=>{
				return (
					<Row>
						<EditPrivatePdt
							data={record}
						/>
						{/*<Popconfirm title="确定删除?"  cancelText="取消" onConfirm={() => onDelete(record.productId)}>
							<a>删除</a>
						</Popconfirm>*/}
					</Row>
				)
			}
		}
	];
	function onDelete(v){
		dispatch({
			type:'privatePdt/deletePrivatePdt',
			payload:{
				'productId':v
			}
		})
	}
	
	if(pdtData){
		return(
			<div className={style.privateTable}>
				<Table
					columns={columns}
					dataSource={pdtData}
					pagination={false}
					rowKey={record => record.productId}
				/>
				<TablePagination
      		page={page}
      		tag='privatePdt'
      		dispatch={dispatch}
      		className={style.TablePagina}
      	/>
			</div>
		)
	}else{
		return null;
	}
	
}

PrivateTable.propTypes = {
}

export default connect(({privatePdt})=>({privatePdt}))(PrivateTable)